﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
public partial class zoushitu_dlt_dlt_jozs : System.Web.UI.Page
{
    protected List<Model.LotteryAnnouncement> arlist = null;
    protected string[] SSQList = null;
    protected string SSQblue = null;
    protected DataTable dtPaperList = new DataTable();
    protected int jinqiCount = 0;
    protected Hashtable qqjs_dt = new Hashtable();//前区奇数
    protected Hashtable qqos_dt = new Hashtable();//前区偶数
    protected Hashtable hqjs_dt = new Hashtable();//后区奇数
    protected Hashtable hqos_dt = new Hashtable();//后区偶数

    protected Hashtable qqjs_tiao = new Hashtable();
    protected Hashtable qqos_tiao = new Hashtable();
    protected Hashtable hqjs_tiao = new Hashtable();
    protected Hashtable hqos_tiao = new Hashtable();
    protected int TiaoXing;

    protected void Page_Load(object sender, EventArgs e)
    {
        ZoushiManage.FangWenZouShi();
        if (!IsPostBack)
        {
            jinqiCount = 30;
            bindData(30);
        }
    }

    protected void bindData(int maxValue)
    {

        arlist = BLL.LotteryAnnouncement.getDatas(maxValue,2);
        if (arlist != null)
        {
            #region 列表初始化   
            qqjs_dt.Add(17, 35);
            qqjs_dt.Add(16, 33);
            qqjs_dt.Add(15, 31);
            qqjs_dt.Add(14, 29);
            qqjs_dt.Add(13, 27);
            qqjs_dt.Add(12, 25);
            qqjs_dt.Add(11, 23);
            qqjs_dt.Add(10, 21);
            qqjs_dt.Add(9, 19);
            qqjs_dt.Add(8, 17);
            qqjs_dt.Add(7, 15);
            qqjs_dt.Add(6, 13);
            qqjs_dt.Add(5, 11);
            qqjs_dt.Add(4, 09);
            qqjs_dt.Add(3, 07);
            qqjs_dt.Add(2, 05);
            qqjs_dt.Add(1, 03);
            qqjs_dt.Add(0, 01);


         

            qqos_dt.Add(34, 34);
            qqos_dt.Add(33, 32);
            qqos_dt.Add(32, 30);
            qqos_dt.Add(31, 28);
            qqos_dt.Add(30, 26);
            qqos_dt.Add(29, 24);
            qqos_dt.Add(28, 22);
            qqos_dt.Add(27, 20);
            qqos_dt.Add(26, 18);
            qqos_dt.Add(25, 16);
            qqos_dt.Add(24, 14);
            qqos_dt.Add(23, 12);
            qqos_dt.Add(22, 10);
            qqos_dt.Add(21, 08);
            qqos_dt.Add(20, 06);
            qqos_dt.Add(19, 04);
            qqos_dt.Add(18, 02);

            hqjs_dt.Add(40, 11);
            hqjs_dt.Add(39, 09);
            hqjs_dt.Add(38, 07);
            hqjs_dt.Add(37, 05);
            hqjs_dt.Add(36, 03);
            hqjs_dt.Add(35, 01);


            hqos_dt.Add(46, 12);
            hqos_dt.Add(45, 10);
            hqos_dt.Add(44, 08);
            hqos_dt.Add(43, 06);
            hqos_dt.Add(42, 04);
            hqos_dt.Add(41, 02);
            #endregion

          
            for (int i = 0; i < arlist.Count; i++)
            {
                //重号
                string[] redBall = arlist[i].LotteryNo.Split('+')[0].Split(',');
                for (int m = 0; m < redBall.Length; m++)
                {
                    //计算条形图中每个数的个数红球
                    bindTiaoxing(0, int.Parse(redBall[m]));

                }

                string[] blueBall = arlist[i].LotteryNo.Split('+')[1].Split(',');
                for (int m = 0; m < blueBall.Length; m++)
                {
                    //计算条形图中每个数的个数红球
                    bindTiaoxing(1, int.Parse(blueBall[m]));

                }
            }
            #region
            foreach (DictionaryEntry de in qqjs_dt)
            {
                int a = int.Parse(de.Value.ToString()) - 1;
                string b = TiaoxingDT[a].ToString();
                qqjs_tiao.Add(de.Key, b);
            }
            foreach(DictionaryEntry de in qqos_dt)
            {
                int a = int.Parse(de.Value.ToString()) - 1;
                string b = TiaoxingDT[a].ToString();
                qqos_tiao.Add(de.Key, b);
            }
            foreach(DictionaryEntry de in hqjs_dt)
            {
                int a = int.Parse(de.Value.ToString()) - 1;
                string b = TiaoxingDT[a].ToString();
                hqjs_tiao.Add(de.Key, b);
            }
            foreach(DictionaryEntry de in hqos_dt)
            {
                int a = int.Parse(de.Value.ToString()) - 1;
                string b = TiaoxingDT[a].ToString();
                hqos_tiao.Add(de.Key, b);
            }
            #endregion
        }



    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        jinqiCount = int.Parse(DropDownList1.SelectedValue);
        bindData(int.Parse(DropDownList1.SelectedValue));

    }
    protected int[] TiaoxingDT = new int[47];
    protected void bindTiaoxing(int type, int data)
    {
        for (int i = 0; i < 47; i++)
        {
            if (type == 0)
            {
                if (data == (i + 1))
                {
                    TiaoxingDT[i] += 1;
                }
            }
            if (type == 1)
            {
                if (data == (i + 1 - 35))
                {
                    TiaoxingDT[i] += 1;
                }
            }
        }
    }

}